class_name HurtBox
extends Node2D

#region 属性
#endregion
#region 字段
var _entity:
	get:
		if not _entity:
			var combat_component:CombatComponent = Utils.find_parent_by_type(self,CombatComponent,-1)
			if combat_component:
				_entity = combat_component.entity
		return _entity
#endregion
#region 信号
#endregion

#region 基类方法
#endregion
#region 公共方法
func get_entity() -> Entity:
	return _entity
func hurt(hurt_message:HurtMessage):
	var entity = get_entity()
	if not entity:
		return
	match hurt_message.hurt_message_type:
		GameEnum.HurtMessageType.Null:
			return
		GameEnum.HurtMessageType.Hurt:
			var combat_component:CombatComponent = Utils.find_parent_by_type(self,CombatComponent,-1)
			if combat_component:
				combat_component.hurt(hurt_message)
		GameEnum.HurtMessageType.Recover:
			var combat_component:CombatComponent = Utils.find_parent_by_type(self,CombatComponent,-1)
			if combat_component:
				combat_component.recover(hurt_message)
		_:
			return
#endregion
#region 私有方法
#endregion
#region 生命周期函数
#endregion
